#create
a = "temp"
b = "test"
a+=b
print(a)

#retrieve
content = "abcdefg"
print(f'find e in : {content.find("e")}')
print(content.index("e"))
print(content.startswith("ab"))
print(content.endswith("fg"))
print(content[4:6])

#update
content.replace("b", "k")
exchange = content.replace("b", "k")
print(exchange)

#split
data_str = "123abc456"
d_sp = data_str.split("abc")
print(d_sp)

#join
data_j = "abc".join(d_sp)
print(data_j)

#delete
content = "[a,c,d]"
a = content.strip('[]')
print(a)
a = content.lstrip('[')
print(a)
a = content.rstrip(']')
print(a)

#按输入参数的默认顺序
a = "{}:{}:23".format(20, 18)
#print("{}:{}".format(20, 18))
print(a)

#按指定参数索引
"{0},{1},{2},{1}".format("aa", "cc", "dd")
print("{0},{1},{2},{1}".format("aa", "cc", "dd"))

#按关键字参数
print("{place}-{num}".format(place="Italy", num="one"))

#按变量
city = "guangzhou"
print(f'{city}-aaa')

#处理浮点数
print("{:.5f}".format(3.1415926))

f1 = open("第二周_第二节tmp.py", "r", encoding="utf-8")
a = f1.read()

f2 = open("第二周_第二节.py", "w", encoding="utf-8")
f2.write(a)

f1.close()
f2.close()
